using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Animator anim;
    private Rigidbody rigi;
    public float JumpForce;
    public float gravityModifier = 3.2f;
    private bool Isjump = true;
    public ParticleSystem dirtSplatter;

    // Start is called before the first frame update
    void Start()
    {
        anim = GetComponent<Animator>();
        anim.SetFloat("Speed_f", 1f);
        anim.SetBool("Static_b", true);
        rigi = GetComponent<Rigidbody>();
        Physics.gravity *= gravityModifier;
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space)&&Isjump==true)
        {
            anim.SetTrigger("Jump_trig");
            rigi.AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
            Isjump = false;
            dirtSplatter.Stop();

        }
    }
    private void OnCollisionEnter(Collision orther)
    {
        Isjump = true;
    }

}
